package com.zhentao.controller;

import com.zhentao.domain.CdzAddress;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.CdzAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 桑田
 **/
@RestController
@RequestMapping("/map")
public class MapController {
    @Autowired
    CdzAddressService service;
    @GetMapping("/list")
    public ResponseResult list(){
        return ResponseResult.okResult(service.list());
    }
    //新增
    @PostMapping("/add")
    public ResponseResult add(@RequestBody CdzAddress address){
        return ResponseResult.okResult(service.save(address));
    }
    //删除
    @DeleteMapping("/delete")
    public ResponseResult delete(@RequestParam("id") Integer id){
        return ResponseResult.okResult(service.removeById(id));
    }
}
